// TOWN DIALOGUE SCRIPT
//    Town 163: Tevrono

begintalkscript;

variables;

short i,j,k,r1,choice;

begintalknode;
	tag = 1;
	state = -1;
	nextstate = -1;
	condition = 1;
	text1 = "Though you are foreigners, the soldiers recognize you as fellow warriors against the scourges attacking Valorim. The soldiers here are competent and confident. They happily trade tales of battle with you.";
	text2 = "They tell you about the golems. The constructs are deadly and relentless. Only General Baziron of Tevrono has any luck holding them back. They suggest that you talk to him. His office is in the northeast corner of the fort.";
	text3 = "They are drunk, celebrating their apparent victory over the golems. They are roaming the woods, hunting down the newly-helpless golems and smashing them. Then they plan to march to Tinraya and reclaim the province from the alien beasts.";
	code = 
		if (gf(308,0) == 0)
			rs(3);
			else rs(2);
	break;

// General Baziron

begintalknode;
	tag = 40;
	state = -1;
	nextstate = 1;
	question = "General Baziron";
	text1 = "You meet a full general of the Empire army. You stare at each other. It's a tense moment.";
	text2 = "Then he stands and firmly shakes your hand. _I am General Baziron. Welcome to Tevrono, Avernite._ His voice is deep and rough, his skin scarred and sunburnt. He is a man who has spent most of his life outdoors, much of it in combat.";
	text5 = "General Baziron says, _What else do you wish to know? How can we work to destroy more monsters?_ Though the general is an Empire dervish, he is unusually polite to you, considering where you are from.";
	action = INTRO;

begintalknode;
	state = 1;
	condition = gf(15,7) == 1;
	question = "_I've met Dervish Bruskrud of Lorelei. She said that I should find you._";
	text1 = "He smiles. _I know. My soldiers make sure I know what I need to. I'm glad you made it here. You have done much for Valorim. I hope I can convince you to do more._";
	code =
		sf(15,7,2);
		toggle_quest(109,10);
	break;

begintalknode;
	state = 1;
	nextstate = 2;
	question = "_What are your responsibilities in Valorim?_";
	text1 = "He sighs. _It has fallen to me to lead our forces against the monsters. We, I'm afraid, are their only effective opposition._";

begintalknode;
	state = 2;
	nextstate = 3;
	question = "_How goes your fight with the golems?_";
	text1 = "He chuckles. _The golems are lethal foes. However, they have their weaknesses. I have developed tactics against them. This is good, as we're the only people in Monoroe Province who have had any luck opposing them._";
	text3 = "He looks uncomfortable. _We appreciate your help against the golems, but now we have the problem of surviving the peace._";
	action = DEP_ON_SDF 308 0 0;

begintalknode;
	state = 3;
	nextstate = -1;
	condition = gf(308,0) == 0;
	question = "_Why isn't there opposition from the other towns in Monoroe Province?_";
	text1 = "He frowns. _Those fools in Gale, they don't realize the golems are a different foe from humans or nephilim, and they need different tactics. We out here in Tevrono have been the only troops who've had any luck against those things._";

begintalknode;
	state = 3;
	nextstate = 4;
	condition = gf(308,0) == 0;
	question = "_You don't have much respect for the leadership in Gale._ ";
	text1 = "_'Tis not wise to criticize the leadership in Gale too strongly. But they won't listen to us and they won't support us. That's the reason I wanted to speak with you._";

begintalknode;
	state = 2;
	nextstate = 11;
	condition = gf(308,0) >= 1;
	question = "_What problems have developed since the defeat of the golems?_";
	text1 = "_The leaders of Gale are jealous of our past success against the golems. My troops and I are in great danger. We must be very careful in what we say and to whom. I cannot speak to you._";
	text2 = "_Though it shames me to be so rude to those who have helped us, I must think of my men. Good fortune to you, and I hope your path takes you soon to Blackcrag Fortress.";

begintalknode;
	state = 11;
	nextstate = -1;
	condition = gf(163,16) <= 1;
	question = "_Tell me about Blackcrag Fortress._";
	text1 = "_It is the main gateway between Valorim and the rest of the Empire, a huge fortress in the mountains to the northwest. I have heard rumors that Empress Prazac is there now. I don't think we will be able to completely defeat the monsters without her help._";
	text2 = "_I must stay here and fight. If you want to help us, that is where you should go. I dont know how you can get in. Ask in the towns nearby. Someone might have seen or heard something._";
	text3 = "_Good luck to you._ He turns away.";
	action = END_TALK;
	code =
		sf(163,16,1);
		toggle_quest(112,1);
	break;
	
begintalknode;
	state = 3;
	nextstate = 4;
	condition = gf(308,0) == 0;
	question = "_What tactics do you use against the golems?_";
	text1 = "_Tactics that are good for small bands of soldiers. Probably nothing that'd help you, but I'll give you one example of how we've been able to defeat them. It's unrelated to the reason I wanted to speak with you._";

begintalknode;
	state = 4;
	nextstate = 5;
	question = "_Tell us that example._";
	text1 = "_The golems are not smart like living things. They act only in a certain way, and they can't adapt to new situations. So if we study how they behave in a situation, we can find a weakness in their tactics and they can't figure out how to deal with it._";
	text2 = "_For example, consider how they bombard our walls._";

begintalknode;
	state = 5;
	nextstate = 4;
	question = "_How do they bombard your walls?_";
	text1 = "_They approach within eighty feet, throw fireballs and ice bolts, and flee. However, if we sneak up behind them and attack just when they're firing over the walls, it takes them a long time to react. They're smashed by then._";
	text2 = "_If the fools in Gale saw this, the war would go much differently. But that's not the reason I wanted to speak with you._";

begintalknode;
	state = 4;
	nextstate = 6;
	question = "_Why did you wish to speak with me?_";
	text1 = "_We're doing all right against the golems, but we need help. We're chopping at them and slowing them down, but we don't have the strength to find and assault their source._";

begintalknode;
	state = 6;
	nextstate = 1;
	condition = gf(163,12) <= 1;
	question = "_You would like me to find and assault the source of the golems._";
	text1 = "_I've heard of you. You have had luck infiltrating and destroying the enemies' fortresses. I would like you to do the same thing here. I can't tell you where the golems are coming from, but I can tell you one valuable fact._";
	action = SET_SDF 163 12 1;
	code =
		toggle_quest(8,1);
	break;
	
begintalknode;
	state = 1;
	nextstate = 25;
	condition = gf(163,12) == 1 && gf(308,0) == 0;
	question = "_What can you tell me about the golems?_";
	text1 = "_There are mountains to the southeast. Far up in them lives a mage. He visited us, flying down from the sky like a bird. He said someone should go up to see him. He knows much about the golems. Why he wanted us to go up there, we don't know._";
	text2 = "_But I thought you might want to know. You may be our only hope against the golems._";
	code =
		toggle_quest(111,1);
	break;

begintalknode;
	state = 25;
	nextstate = -1;
	question = "_Why didn't you send someone to visit this man yourself?_";
	text1 = "_He lives at the top of a tall cliff. He can fly. None of my men can._";

begintalknode;
	state = 1;
	nextstate = 1;
	condition = has_spec_item(50) > 0;
	question = "_Some of your men near Greendale gave me a message to deliver to you._";
	code =
		run_hardcode(36);
	break;

begintalknode;
	state = 1;
	nextstate = -1;
	condition = gf(308,0) == 0 && gf(106,11) > 1;
	question = "I know how to find the golem spire. (Describe it.)";
	text1 = "Baziron takes down the information. _This is very useful. And very frustrating. I would love nothing more than to assault the golem spire. However, it would overextend our forces and put my own army at risk._";
	text2 = "_You are cunning and experienced. You might be able to raid the spire. If you were able to sabotage the golem machinery, the Empire would owe you a true debt._";
	
begintalknode;
	state = 1;
	nextstate = -1;
	condition = gf(308,0) >= 1 && gf(163,12) <= 1;
	question = "_I have destroyed the source of the golems._ (Tell the General about it.)";
	code =
		run_hardcode(37);
	break;

begintalknode;
	state = 1;
	nextstate = 10;
	condition = gf(163,12) == 1;
	question = "_Can you give me any supplies to help battle the golems?_";
	text1 = "_No. We barely have enough to keep fighting here._";

begintalknode;
	state = 10;
	nextstate = -1;
	condition = gf(163,13) <= 1;
	question = "_Can I get any training here?_";
	text1 = "_We don't have much time to help outsiders, I am afraid. We only have time to spare for those we fight with, shoulder to shoulder._";

begintalknode;
	state = 1;
	nextstate = -1;
	condition = gf(163,13) >= 2;
	question = "_Can I get any training here?_";
	text1 = "_We normally don't have much time to help outsiders, but since you helped me out, I'll help you out. Talk to Tenuta. She used to be a skilled swordswoman. She may be able to give you some tips._";
	action = SET_SDF 163 15 1;

begintalknode;
	state = 1;
	nextstate = -1;
	condition = gf(163,12) == 1 && gf(163,13) <= 1;
	question = "_Are there any other things I can do to help you out?_";
	text1 = "_I am a practical man. I never turn down an offer of assistance in a difficult situation._ He thinks. _South of here, there is a bridge spanning a river. West of there, across the water, there is a band of golem scouts._";
	text2 = "_I believe they are watching our movements and using the information against us. I don't know how. But, if you could destroy them, it would set my mind at ease._";
	action = SET_SDF 163 13 1;
	code =
		toggle_quest(80,1);
	break;

begintalknode;
	state = 1;
	nextstate = -1;
	condition = gf(163,13) == 1 && gf(224,11) >= 1;
	question = "_I destroyed the golems that were watching the bridge._";
	code =
		run_hardcode(48);
	break;

begintalknode;
	state = 1;
	nextstate = -1;
	question = "_You know that I am an Avernite, and it does not bother you?_";
	text1 = "_No. At first, I thought that the golems might be the work of your kind. But I fought you in the Avernum war and I came, in some small way, to know you._";
	text2 = "_You are disloyal to the Empire. You are foes. But you are not monsters. You would not make those things. And since we have a common foe in the golems, I will work with you._";

begintalknode;
	state = 1;
	nextstate = -1;
	condition = gf(163,14) == 0 && gf(224,12) >= 1;
	question = "_I met some of your people on a bridge to the south. I helped them with a golem ambush._";
	text1 = "_Ah, yes. A new golem tactic, the water approach. They start using these new tricks sometimes. I will soon have a retort for this, some sort of trap or ambush, and we will no longer be vulnerable._";
	text2 = "_But where are my manners? Thank you for saving my people. It is a surprising and unexpected kindness, especially coming from an Avernite._";
	action = SET_SDF 163 14 1;
	code =
		award_party_xp(100,25);
	break;

begintalknode;
	state = 1;
	nextstate = -1;
	condition = 1;
	question = "_I'll be going now._";
	text1 = "Baziron nods. _Good hunting. Your kind and ours have been enemies, but now we fight the same fight._";
	action = END_TALK;	
	
// Ozmo

begintalknode;
	tag = 60;
	state = -1;
	nextstate = 29;
	question = "Ozmo";
	text1 = "A man sits alone in the empty inn, working on a map. He is the only unarmed man you have seen in this entire town. _I am Ozmo. Nice to see civilians._";
	text5 = "Ozmo sits alone in the empty inn, working on a map. ";
	action = INTRO;

begintalknode;
	state = 29;
	nextstate = 30;
	question = "_Why are you sitting in here alone?_";
	text1 = "_I'm a mapmaker. I'm stranded here, I'm afraid._";

begintalknode;
	state = 30;
	nextstate = 31;
	question = "_What are your maps of?_";
	text1 = "He cheers up. _That's my trade! I've been making maps of the area, to help Baziron and his troops. If you want, you can purchase a map of Monoroe Province._";

begintalknode;
	state = 30;
	nextstate = -1;
	question = "_How did you get stranded?_";
	text1 = "He sighs. _I've been here for months. I came here on a mapmaking trip, just before the golems made a major advance and encircled Tevrono. Now, I probably can't get away without risking death. So I just sit here, wait, and make maps._";

begintalknode;
	state = 31;
	nextstate = 29;
	question = "_What do you think of Baziron?_";
	text1 = "_The only general who has had any success against the golems. You should see him. He's a hero!_";

begintalknode;
	state = 29;
	nextstate = 33;
	condition = gf(309,22) == 0;
	question = "_Is that map for sale?_";
	text1 = "_Sure. I'll have to charge you, though. A full map of Monoroe Province is 50 coins._";

begintalknode;
	state = 33;
	nextstate = -1;
	condition = gf(309,22) == 0 && coins_amount() >= 50;
	question = "_I'll take it!_ Pay 50 coins.";
	text1 = "You pay Ozmo and get a map in return. _Maybe I can use my money to bribe a patrol and get an escort out of here._";
	text2 = "Monoroe Province is now detailed on your World Map.";
	action = END_TALK;	
	code =
		change_coins(-50);
		sf(309,22,1);
	break;
	
begintalknode;
	state = 33;
	nextstate = -1;
	condition = gf(309,22) == 0;
	question = "_No, thank you._";
	text1 = "Ozmo shrugs and returns to work.";
	action = END_TALK;	


begintalknode;
	state = 29;
	nextstate = -1;
	question = "_What happened to this inn?_";
	text1 = "_Closed. The owner fled. You can rest in one of the back rooms, if you want._";

// Tenuta

begintalknode;
	tag = 80;
	state = -1;
	nextstate = 57;
	question = "Tenuta";
	text1 = "You meet Tevrono's weaponsmith. She is almost frantically busy, struggling to keep up with the endless demands of the soldiers here.";
	text2 = "_I'm Tenuta,_ she says breathlessly. You look over her work. It's very good.";
	text5 = "Tenuta is frantically busy, struggling to keep up with the demands of her job. She spends time talking to you, but she doesn't really want to.";
	action = INTRO;

begintalknode;
	state = 57;
	nextstate = 58;
	question = "_Why are you so busy?_";
	text1 = "_Helping keep Baziron's troops supplied. You can purchase some things too. I still have some of my old stock. You should talk to the General. I'm sure he wants to see you._";

begintalknode;
	state = 58;
	nextstate = -1;
	question = "_Baziron's troops must be busy._";
	text1 = "_General Baziron has figured out how the golems move and act, and he figures out ways to kill them. It's an honor to supply his troops. I make them weapons, and repair them when I have the time._";

begintalknode;
	state = 58;
	nextstate = -1;
	condition = gf(163,12) == 0;
	question = "_You do good work. Can you craft something for me?_";
	text1 = "_Sorry. Too busy. If you were helping the general, it'd be different._";

begintalknode;
	state = 58;
	nextstate = -1;
	condition = gf(163,12) > 0;
	question = "_I've agreed to fight for General Baziron. You do good work. Can you craft something for me?_";
	text1 = "Tenuta sighs. _Another job. I'll never sleep again. But fine. If Baziron thinks you're that useful, I can craft weapons for you._";
	code =
		sf(163,18,1);
	break;
	
begintalknode;
	state = 57;
	nextstate = -1;
	question = "_Let's trade._";
	text1 = "You conclude your business.";
	code =
		begin_shop_mode("Tenuta's Blades","Tenuta used to be a merchant and weaponsmith, before the war with the golems started. She still has some of her stock from those happier times.",114,6,3);
	break;

begintalknode;
	state = 57;
	nextstate = 59;
	condition = gf(163,15) >= 1;
	question = "_General Baziron said that you can provide training?_";
	text1 = "She sighs. _Like I don't have enough problems. Still, you did help us. So I should help you. I used to fight. A lot. I can't deliver the strongest blow, but I know how to keep a foe from hitting me._";
	text2 = "_In the end, that's what it's all about. Not dying. I can teach you what I know. But not for free._";
	code =
		sf(163,18,1);
	break;
	
begintalknode;
	state = 59;
	nextstate = -1;
	question = "_I would like training._";
	text1 = "You conclude your business.";
	code =
		begin_shop_mode("Tenuta's Training","Tenuta has taken the necessary skill of parrying and elevated it to an art. She will share her knowledge with you, but it won't be cheap.",115,6,3);
	break;

begintalknode;
	state = 59;
	nextstate = 57;
	question = "_I don't want training._";
	text1 = "_That's a relief. I don't really have the time._";

begintalknode;
	state = 57;
	nextstate = -1;
	condition = 1;
	question = "_I would like to sell something._";
	text1 = "You conclude your business.";	
	code = 
		begin_sell_mode();
	break;

begintalknode;
	state = 57;
	nextstate = 61;
	condition = gf(163,18) > 0;
	question = "_Can you craft armor and weapons for me?_";
	text1 = "_I can. If the general respects you, so do I. My best patterns require at least eight pieces of the finest steel and three focusing crystals for building and holding power._";
	text2 = "_Also, I have recently found a way to treat a steel breastplate, using the juices of a fresh-squeezed gazer eyestalk. If you have located a quality eyestalk, I can make remarkable armor._";

begintalknode;
	state = 61;
	nextstate = 57;
	condition = num_of_item(296) < 8 || num_of_item(295) < 3;
	question = "_I don't have what you need._";
	text1 = "_Oh. _Well, return when you do. I need to get back to work._";
	action = END_TALK;

begintalknode;
	state = 61;
	nextstate = -1;
	condition = num_of_item(296) >= 8 && num_of_item(295) >= 3;
	question = "_Please make a new sword._ Give 8 fine steel and 3 crystals.";
	text1 = "You give her the materials. She says, _Go practice. I'll have your weapon ready soon._";
	text2 = "You spend a little time practicing in the central courtyard, followed by a longer time hanging out with the soldiers and scouts. When you return to Tenuta, she has a nice, new blade for you.";
	action = REUSABLE;
	code =
		take_num_of_item(296,8);
		take_num_of_item(295,3);
		reward_give(76);
		inc_flag(309,18,1);
	break;
	
begintalknode;
	state = 61;
	nextstate = -1;
	condition = num_of_item(296) >= 8 && num_of_item(295) >= 3;
	question = "_Please make a new pair of bracers._ Give 8 fine steel and 3 crystals.";
	text1 = "You give her the materials. She says, _Go practice. I'll have your armor ready soon._";
	text2 = "You spend a little time practicing in the central courtyard, followed by a longer time hanging out with the soldiers and scouts. When you return to Tenuta, she has a nice, new pair of bracers for you.";
	action = REUSABLE;
	code =
		take_num_of_item(296,8);
		take_num_of_item(295,3);
		reward_give(113);
		inc_flag(309,18,1);
	break;

begintalknode;
	state = 61;
	nextstate = -1;
	condition = num_of_item(296) >= 8 && num_of_item(295) >= 3;
	question = "_Please make a new pair of gauntlets._ Give 8 fine steel and 3 crystals.";
	text1 = "You give her the materials. She says, _Go practice. I'll have your armor ready soon._";
	text2 = "You spend a little time practicing in the central courtyard, followed by a longer time hanging out with the soldiers and scouts. When you return to Tenuta, she has a nice, new pair of gauntlets for you.";
	action = REUSABLE;
	code =
		take_num_of_item(296,8);
		take_num_of_item(295,3);
		reward_give(344);
		inc_flag(309,18,1);
	break;

begintalknode;
	state = 61;
	nextstate = -1;
	condition = num_of_item(296) >= 9 && num_of_item(295) >= 3 && num_of_item(438) > 0;
	question = "_Please make an awesome steel breastplate._ Give one gazer eyestalk, 9 fine steel, and 3 crystals.";
	text1 = "You give her the materials. She says, _Go practice. I'll have your armor ready soon._";
	text2 = "You spend a little time practicing in the central courtyard, followed by a longer time hanging out with the soldiers and scouts. When you return to Tenuta, she has a nice, gleaming steel breastplate for you. _Impressive, no?_";
	action = REUSABLE;
	code =
		take_num_of_item(296,9);
		take_num_of_item(295,3);
		take_num_of_item(438,1);
		reward_give(46);
		inc_flag(309,18,1);
	break;

begintalknode;
	state = 61;
	nextstate = -1;
	condition = num_of_item(296) >= 8 && num_of_item(295) >= 3;
	question = "_I have the materials, but I don't want anything right now._";
	text1 = "_Whew. What a relief._ She gets back to work.";
	action = END_TALK;

begintalknode;
	state = 57;
	nextstate = -1;
	condition = 1;
	question = "_I don't need anything._";
	text1 = "_Whew. What a relief._ She gets back to work.";
	action = END_TALK;